home *** CD-ROM | disk | FTP | other *** search
/ The Best of Tucows 3 / The Best of Tucows 3 - Disc 2.iso / content / win3x / files3x / nt16424.exe / netsend.c < prev    next >
C/C++ Source or Header  |  1996-01-24  |  2KB  |  53 lines

  1.  /**********************************************************************
  2.  *                   InterSoft International, Inc                      *
  3.  *                        Copyright (C) 1995                           *
  4.  ***********************************************************************
  5.  * System:   IBM PC                                                    *
  6.  * Program:  NETSEND.C                                                 *
  7.  * Author:   K.R. Robinette                                            *
  8.  * Date:     January, 1996                                             *
  9.  * Function: Remote Printing Support                                   *
  10.  *           Supports HP Printer Escapes and long lines.               *
  11.  **********************************************************************/
  12. #include "stdio.h"
  13. #include "string.h"
  14.  
  15.  char on[5]  = {"\033[5i"};
  16.  char off[5] = {"\033[4i"};
  17.  
  18.  main(argc,argv)
  19.  int argc;
  20.  char **argv;
  21.  {
  22.  int  len,flag;
  23.  FILE *fd;
  24.  char line[1024];
  25.  if(argc == 2)
  26.       {
  27.       if((fd = fopen(argv[1],"r")) == NULL)
  28.            {
  29.            printf("Error, could not open %s\n",argv[1]);
  30.            exit(-1);
  31.            }
  32.       if((fwrite(on,1,4,stdout)) != 4)
  33.            {
  34.            printf("Error, writing to network\n");
  35.            exit(-1);
  36.            }
  37.       while(1)
  38.            {
  39.            if(fgets(line,1023,fd) == NULL)
  40.                 break;
  41.            len = strlen(line);
  42.            fwrite(line,1,len,stdout);
  43.            }
  44.       fwrite(off,1,4,stdout);
  45.       }
  46.       else
  47.            {
  48.            printf("Input filename required\n");
  49.            exit(-2);
  50.            }
  51.  fclose(fd);
  52.  }
  53.